<%-- 
    Document   : editterm
    Created on : May 21, 2012, 1:56:56 PM
    Author     : Jayson Kiong
--%>

<%@page import="java.util.ArrayList"%>
<%@page import="Model.Types"%>
<%@page import="Model.Terms"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Edit Terms</title>
        <link rel = "stylesheet" type = "text/css" href = "quicklendstyle.css"/>
        <script src="gen_validatorv4.js" type="text/javascript"></script>
    </head>
    <body>
        <%Terms term = (Terms)session.getAttribute("term");
          ArrayList typear = (ArrayList)session.getAttribute("types");
          Types type = new Types();
          int arsize = typear.size();
          int arctr=0,j=0;
        %>
            <div id="contenttitle" style="position: absolute; top:13px; left:25px;">
            Edit Term
            </div>
        <form id="edittermform" action="UpdateTermServlet" method="POST">
            <table id="editcontent"style="position:absolute; top:70px; left:30px; filter:alpha(opacity=100)">
            
                <tr>
                    <td>Terms:</td><td><select name="term" style="width:160px">
                                       <% for (int i=1;i<=60;i++){
                                          j=i*6;
                                          if(j==Integer.parseInt(term.getStrTerm())){%>
                                          <option value="<%=j%>" selected><%=j%></option>
                                          <%}else{%>
                                          <option value="<%=j%>"><%=j%></option>
                                          <%}}%>
                                       </select></td>
                </tr>
                <tr>
                    <td>Client Type:</td><td><select name="clienttype" style="width:160px">
                                                        <%for(int x=0;x<arsize;x++){
                                                        type=(Types)typear.get(arctr); 
                                                        if(type.getStrType().equals("Client")){
                                                            if(term.getStrClienttype()!=null && term.getStrClienttype().equals(type.getStrName())){
                                                        %>
                                                        <option value="<%=type.getStrName()%>" selected><%=type.getStrName()%></option>
                                                        
                                                        <%}
                                                         else{%>
                                                         <option value="<%=type.getStrName()%>"><%=type.getStrName()%></option>       
                                                           <%}}%>   
                                                        <%arctr++;}%> 
                                            </select></td>
                </tr>
                <tr>
                    <td>Loan Type:</td><td><select name="loantype" style="width:160px">
                                               <%arctr=0;
                                               for(int x=0;x<arsize;x++){
                                               type=(Types)typear.get(arctr); 
                                               if(type.getStrType().equals("Loan")){
                                                      if(term.getStrLoantype()!=null && term.getStrLoantype().equals(type.getStrName())){
                                               %>
                                               <option value="<%=type.getStrName()%>" selected><%=type.getStrName()%></option>
                                                        
                                               <%}
                                               else{%>
                                               <option value="<%=type.getStrName()%>"><%=type.getStrName()%></option>       
                                               <%}}%>   
                                               <%arctr++;}%> 
                                            </select></td>
                </tr>
                <tr>
                    <td>Sub Type:</td><td><select name="subtype" style="width:160px">
                                                <%arctr=0;
                                                for(int x=0;x<arsize;x++){
                                                type=(Types)typear.get(arctr); 
                                                if(type.getStrType().equals("Sub")){
                                                    if(term.getStrSubtype()!=null && term.getStrSubtype().equals(type.getStrName())){
                                                %>
                                                    <option value="<%=type.getStrName()%>" selected><%=type.getStrName()%></option>
                                                        
                                                   <%}
                                                   else{%>
                                                    <option value="<%=type.getStrName()%>"><%=type.getStrName()%></option>       
                                                   <%}}%>   
                                                <%arctr++;}%> 
                                          </select></td>
                </tr>
                <tr>
                    <td>Less UI:</td><td><input type="text" name="lessui" value="<%=term.getfLessui()%>">%<div id='edittermform_lessui_errorloc' style="color:#FF0000"></div></td>
                </tr>
                <tr>
                    <td>Service Charge:</td><td><input type="text" name="servicecharge" value="<%=term.getfServicecharge()%>">%<div id='edittermform_servicecharge_errorloc' style="color:#FF0000"></div></td>
                </tr>
                <tr>
                    <td>Notary Fee:</td><td><input type="text" name="notaryfee" value="<%=term.getfNotaryfee()%>">%<div id='edittermform_notaryfee_errorloc' style="color:#FF0000"></div></td>
                </tr>
                <tr>
                    <td>Evat:</td><td><input type="text" name="evat" value="<%=term.getfEvat()%>">%<div id='edittermform_evat_errorloc' style="color:#FF0000"></div></td>
                </tr>
                <tr>
                    <td>Docs:</td><td><input type="text" name="docs" value="<%=term.getfDocs()%>">%<div id='edittermform_docs_errorloc' style="color:#FF0000"></div></td>
                </tr>
                <tr>
                    <td>Collection Fee:</td><td><input type="text" name="collectionfee" value="<%=term.getfCollectionfee()%>">%<div id='edittermform_collectionfee_errorloc' style="color:#FF0000"></div></td>
                </tr>
                <tr>
                    <td>Processing Fee</td><td><input type="text" name="processingfee" value="<%=term.getfProcessingfee()%>">%<div id='edittermform_processingfee_errorloc' style="color:#FF0000"></div></td>
                </tr>
                <tr>
                    <td>Bank Charge</td><td><input type="text" name="bankcharge" value="<%=term.getfBankcharge()%>"><div id='edittermform_bankcharge_errorloc' style="color:#FF0000"></div></td>
                </tr>
                <tr>
                    <td>LBC Charge:</td><td><input type="text" name="lbccharge" value="<%=term.getfLbccharge()%>"><div id='edittermform_lbccharge_errorloc' style="color:#FF0000"></div></td>
                </tr>
                <tr>
                    <td>Cash Bound:</td><td><input type="text" name="cashbound" value="<%=term.getfCashbound()%>"><div id='edittermform_cashbound_errorloc' style="color:#FF0000"></div></td>
                </tr>
                <tr>
                    <td>Commission:</td><td><input type="text" name="commission" value="<%=term.getfCommission()%>">%<div id='edittermform_commission_errorloc' style="color:#FF0000"></div></td>
                </tr>
                <tr>
                   <td><input type="hidden" style="width:150px;" name="termid" value="<%=term.getiTermid()%>"></td>
                </tr>
                
                <tr>
                    <td></br></td>
                </tr>
                <tr>
                    <td>*All fields are required</td>
                </tr>
                
                    
            </table>
             <div id="edittermfunction" style="position:absolute;top:550px;left:450px;">
                <input type="image" src="images/saveimage.png" size="13" style="position:absolute; left:0px"/>
                <a href="#" class="precompcancelbtn" name="precompcancelbtn"  size="13" style="position:absolute; left:170px"/></a>     
            </div>
        </form>
    </body>
    <script type="text/javascript">
         var frmvalidator  = new Validator("edittermform");
         frmvalidator.addValidation("lessui","req","Please enter amount");
         frmvalidator.addValidation("servicecharge","req","Please enter amount");
         frmvalidator.addValidation("notaryfee","req","Please enter amount");
         frmvalidator.addValidation("evat","req","Please enter amount");
         frmvalidator.addValidation("docs","req","Please enter amount");
         frmvalidator.addValidation("collectionfee","req","Please enter amount");
         frmvalidator.addValidation("processingfee","req","Please enter amount");
         frmvalidator.addValidation("bankcharge","req","Please enter amount")
         frmvalidator.addValidation("lbccharge","req","Please enter amount");
         frmvalidator.addValidation("cashbound","req","Please enter amount");
         frmvalidator.addValidation("commission","req","Please enter amount");
         frmvalidator.addValidation("lessui","num","Invalid Amount");
         frmvalidator.addValidation("servicecharge","num","Invalid Amount");
         frmvalidator.addValidation("notaryfee","num","Invalid Amount");
         frmvalidator.addValidation("evat","num","Invalid Amount");
         frmvalidator.addValidation("docs","num","Invalid Amount");
         frmvalidator.addValidation("collectionfee","num","Invalid Amount");
         frmvalidator.addValidation("processingfee","num","Invalid Amount");
         frmvalidator.addValidation("bankcharge","num","Invalid Amount")
         frmvalidator.addValidation("lbccharge","num","Invalid Amount");
         frmvalidator.addValidation("cashbound","num","Invalid Amount");
         frmvalidator.addValidation("commission","num","Invalid Amount");
        
         frmvalidator.EnableOnPageErrorDisplay();
         frmvalidator.EnableMsgsTogether();
    </script>
</html>
